﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfCommGoodsLevelOne.aspx.cs" Inherits="msBsc.WebUi.wfCommGoodsLevelOne" %>

<!DOCTYPE HTML>
<html>
<head id="Head1" runat="server"> 
    <title>商家自定义导航分类</title>
    <link rel="shortcut icon" href="/themes/Style1/Image/favicon.ico"
        type="image/x-icon" /> 
    <link rel="stylesheet" href="/??themes/Style1/StyleQt.css,themes/Style1/Dealer.css" />
    <script src="/??jqPlugin/js/jquery-1.8.3.min.js,js/jBase.js,js/jBPage.js,themes/Style1/jsQt.js,themes/Style1/jsDealer.js"
        type="text/javascript"></script>
    <!--head fix rgn-->
    <style type="text/css">        
    </style>
    <script type="text/javascript">
        $(window).load(function () {
            $.ploadFile("Grid", function (script, textStatus) {
                initGrid1();
            });
            $.ploadFile("layer", function (script, textStatus) {
//                layer.load('加载中'); 
            });
        }); 
        function initGrid1() {
            var colsOption = [
            { id: 'chk', isCheckColumn: true, filterable: false, exportable: false },
            { id: 'CT_LEVEL_ONE_ID', hidden: true, filterable: false, exportable: false },
            { id: 'buynow', header: "二级分类", width: 100, resizable: false, filterable: false, exportable: false, sortable: false,renderer: function (value, record, columnObj, grid, colNo, rowNo) {
                return "<a  href=\"javascript:void(0);return false;\" onclick=\"javascript:ShowTwoLevelEdit('" + record.CT_LEVEL_ONE_ID + "','" + record.CT_LEVEL_ONE_NME + "');return false;\" target='_self'>编辑二级分类</a>";
                }
            },
            { id: 'CT_LEVEL_ONE_NME', header: "一级分类名称", width: 220, editor: { type: 'text'} }, 
            { id: 'INITIAL_DT', header: "添加日期", width: 150 },
            { id: 'INITIAL_USR', header: "添加人", width: 150 },
            { id: 'REC_UPDATE_DT', header: "更改日期", width: 150 },
            { id: 'REC_UPDATE_USR', header: "更改人", width: 150 }
            ];
            var gridOption1 = getGtOp('myGrid1', colsOption, 'gridbox1', 'CT_LEVEL_ONE_ID');
            gridOption1.height = "500px";
            gridOption1.autoLoad = true;
            gridOption1.autogtResize = false;
            var myGrid1 = new Sigma.Grid(gridOption1);
            myGrid1.render();
            myGrid1.readOnly = false;
//            btnDo("btnEdit");
//            autogtResize("bigbox2", myGrid1);
        };
        function ShowTwoLevelEdit(_sOneId, _sOneNme) {
            var surl = '/d_CommGoodsLevelTwo.htm?ONE_ID=' + _sOneId;
            if ($('#ifragment2')[0].src != surl) { $('#ifragment2')[0].src = surl; }
            SetLevleShow(2);
            $('#btnToParentLevel1').show().val('返回一级分类：' + _sOneNme);

//            $.layer({
//                type: 2,
//                shade: [0.5, '#000'],
//                fix: true,
//                title: '编辑二级分类-' + _sOneNme,
//                maxmin: true,
//                iframe: { src: '/d_CommGoodsLevelTwo.htm?ONE_ID=' + _sOneId },
//                area: ['800px' , '440px'] 
//            });
        };
        function ShowThreeLevelEdit(_sOneId, _sOneNme) {
            var surl = '/d_CommGoodsLevelThree.htm?TWO_ID=' + _sOneId;
            if ($('#ifragment3')[0].src != surl) { $('#ifragment3')[0].src = surl; }
            SetLevleShow(3);
            $('#btnToParentLevel2').show().val('返回二级分类：' + _sOneNme);
        };

        var currLevelShow = 1;
        function SetLevleShow(ilevel) {
            currLevelShow = ilevel;
            if (ilevel == 1) {
                $('#bigbox2').hide();
                $('#bigbox3').hide();
                $('#bigbox1').show();
                $('#btnToParentLevel1').hide();
                $('#btnToParentLevel2').hide();
            }
            else if (ilevel == 2) {
                $('#bigbox1').hide();
                $('#bigbox3').hide();
                $('#bigbox2').show('slow');
                $('#btnToParentLevel1').show();
                $('#btnToParentLevel2').hide();
            }
            else if (ilevel == 3) {
                $('#bigbox1').hide();
                $('#bigbox2').hide();
                $('#bigbox3').show('slow');
                $('#btnToParentLevel1').show();
                $('#btnToParentLevel2').show();
            }
        };

        function saveLevel() {
            if (currLevelShow == 1) {
                btnDo("btnSave");
            }
            else if (currLevelShow == 2) {
                $('#ifragment2')[0].contentWindow.btnDo("btnSave");
            }
            else if (currLevelShow == 3) {
                $('#ifragment3')[0].contentWindow.btnDo("btnSave");
            }
        };

        function btnDo(sEbtn) {
            GtGrid1Action = sEbtn;
            var opart = GetGtParam("myGrid1");
            if (sEbtn == "btnSave") {
                doSaveGt('myGrid1');
            } 
            else {
                ajaxComm(opart); //调用页面回调，并传入参数
            }
            GtGrid1Action = "";
        };
        function GetGtParam(jqGridID) {
            var _jsParam = new jsonRow();
            if (jqGridID == "myGrid1") {
                GetFormJson("divCondition", _jsParam);
                _jsParam.AddCell("gtGridID", "myGrid1");
                _jsParam.AddCell("ACTION", GtGrid1Action);
                //这里可增加传入后台的参数
            } return _jsParam;
        };
    </script>
</head>
<body>
    <div id="mallPage" class="tms-page mallAct tmall-  page-not-market">
        <!-- -->
        <!--商城通用顶通-->
        <%=new msBsc.WebUi.Code.QtHtmlGet().GetHeaderTopHtml()%>
        <%=new msBsc.WebUi.Code.QtHtmlGet().GetHeaderLogoDealerHtml("商户管理")%>
        <div id="content" class="content" style=" padding-top: 10px;">
            <div class="page lang-zh-S">
                <div id="mytaobao-panel" class="grid-c2">
                    <div class="col-main" id="J_Col_Main" style="padding-bottom: 0;">
                        <div class="main-wrap">
                            <div id="main-content">

                            
        <div id="fragment1" style=" background-color:#fff;">
                                <h2 class="h2-single">
                                    <span class="entity" id="J_DeliverTitle">操作</span></h2> 
            <div id="divCondition" style="margin: 0px; border-style: solid; border-width: 1px; padding:5px;
                border-color: #C8D2E0;">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                        <td align="right"> 
                            <input type="button" class="btn btn-mini btn-danger" onclick="javascript:saveLevel();return false;" value="保存(S)"
                                id="btnSave" accesskey="S" />
                            <input type="button" class="btn btn-mini btn-danger" onclick="javascript:SetLevleShow(1);return false;" value="返回一级分类" style="display:none;"
                               id="btnToParentLevel1"/>  
                            <input type="button" class="btn btn-mini btn-danger" onclick="javascript:SetLevleShow(2);return false;" value="返回二级分类" style="display:none;"
                               id="btnToParentLevel2"/>  
                        </td>
                        <td style=" padding-left:10px;">
                         注意：修改每级分类都必须点一次保存！
                        </td>
                    </tr>
                </table>
            </div>
                                <h2 class="h2-single">
                                    <span class="entity"  >分类导航列表</span></h2> 
            <div id="bigbox1" style="margin: 0px; margin-top: 2px;">
                <div id="gridbox1" style="border: 0px solid #cccccc; background-color: #f3f3f3; padding: 5px;margin-left:-1px;">
                </div>
            </div>
            <div id="bigbox2" style="margin: 0px; margin-top: 2px;height: 503px;display:none;">                
                <iframe id="ifragment2" scrolling="no" frameborder="0" src="" style="width: 100%;height: 500px;
                    height: 100%;"></iframe>
            </div>
            <div id="bigbox3" style="margin: 0px; margin-top: 2px;height: 503px;display:none;">                
                <iframe id="ifragment3" scrolling="no" frameborder="0" src="" style="width: 100%;height: 500px;
                    height: 100%;"></iframe>
            </div>
        </div>
        
                            </div>
                        </div>
                    </div>
                    <!-- end col-main -->
                    <div class="col-sub" id="J_Col_Sub">
                        <%=new msBsc.WebUi.Code.QtHtmlGet().GetDealerMenu()%>
                    </div>
                    <div style="clear:both;"></div>
                </div>
                <!-- end mytaobao-panel -->
            </div>
        </div>
        <%=new msBsc.WebUi.Code.QtHtmlGet().GetFloorHtml()%>
    </div>
    <!-- foot script -->
</body>
</html>
